//华英JS逻辑
$(function(){
	setWH();
	$(window).resize(function(){
		setWH();
	});
	if(isPC()){
		$('#iosDownloadLink').attr('href','javascript:void(0)');
		$('#iosDownloadLink').text('请扫描二维码下载');
	}
});

//设置初始宽高
function setWH(){
	var getW=document.body.clientWidth;
    
    if(getW<1000){
    	$("#warpImg").attr('src','img/download/shuangshi_zzPhone.jpg');
    	
    	$(".myCenter,.yunImg").hide();
    	$(".btnPhone").show();
    	
    }else{    	
    	$("#warpImg").attr('src','img/download/xjkPC.jpg');
    	$(".myCenter,.yunImg").show();
    	$(".btnPhone").hide();
    }
    android_or_ios($(".btnPhone"));

};


//判断终端类型
function android_or_ios(obj){
	var u = navigator.userAgent, app = navigator.appVersion;
	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
	var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
	if(is_weixin()){
		obj.on('click',function(){
			$("#mcover").css('display','block');
		});
		
	}else if(isAndroid){
		obj.attr("href","http://udodl.howdo.cc/xjk/udo_stu.apk");
	}else if(isiOS){
		obj.attr("href","itms-services://?action=download-manifest&amp;url=https://dn-udodl.qbox.me/udo2/20150625/1/manifest.plist");
		if(document.body.clientWidth==768){
			$('.btnPhone').css({
				top:'60%'
			});			
		}
	}
};

//判读是否是pc
function isPC(){  
     var userAgentInfo = navigator.userAgent;
     var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");  
     var flag = true;  
     for (var v = 0; v < Agents.length; v++) {  
         if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }  
     }  
     return flag;  
  }


